package com.bobo.web.provider.util.commutils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

/**
 * Created by liuxin on 2018/3/23.
 *
 * @Description:
 */
public class PatternUtil {
    public static boolean isNumber(String str) {
        return Pattern.matches("^[0-9]*$", str);
    }

    public static boolean isEnglish(String str) {
        return Pattern.matches("^[a-zA-Z]*$", str);
    }

    public static boolean isChinaPhoneLegal(String str) throws PatternSyntaxException {
        String regExp = "^((13[0-9])|(15[0-9])|(18[0-9])|(17[0-9])|(14[0-9])|(19[0-9]))\\d{8}$";
        Pattern p = Pattern.compile(regExp);
        Matcher m = p.matcher(str);
        return m.matches();
    }
}
